<html xmlns="http://www.w3.org/1999/xhtml" id="integrating">
<head>
  <title>Integrating Laszlo into Existing Infrastructures</title>
</head>

<body>

<h1>Integrating LPS into Existing Infrastructures</h1>
 <todo>
Clean up this intro, for starters. . .Chapter is about 50% done. . .
</todo>
<p>how Laszlo is designed to fit into existing architectures, replacing the front end, leaving business-logic back-ends intact, for a non-disruptive upgrade to user experience.  
The target audience for this chapter would be the IT/server manager, who would want to know what adopting Laszlo was going to mean to 
her sever farm, budgets,  another reader would be the lead architect of large applications who would make decisions about how work 
would be split between client and server.
</p>
 
 
<p>This chapter will focus on how to incorporate Laszlo into existing architectures, keeping the back-end more-or-less intact and replacing the front-end,
jsp/asp HTML stuff with Laszlo applications</p>

 
 
<p>This chapter explains that LPS fits into existing architectures that separate ("back end") business logic from 
"front end" user interfaces.  The LPS is a J2EE web app; it "sits in" application servers.

This chapter should have some kind of mini-case study .

Because all data supplied to Laszlo applications in in XML format, Laszlo Apps do not interface directly with 
databases.  Two solutions:
1) Convert to XML -- 
2) Fetch using Pablo's XML RPC class
</p>
 

 
<!--=========================================================================-->
<!-- Major sub-heads in h2, etc                                                               -->
<!--=========================================================================-->
<h2>Struts</h2>
<p>
Struts is well suited to support both HTML based applications and Laszlo
based applications at the same time.  There are many approaches you can
take. One approach would be to write new JSPs, which simply generate XML
instead of HTML. You would then need to create new action mappings in
struts-config.xml, which would forward to the XML generating JSP. This is a
great approach to get started quickly as you can reuse your existing Actions
you already wrote to generate html, but you will only have access to the
data already generated by those actions.
</p>
<p>
Because Laszlo applications are really good at showing a lot more data in a
useful manner than traditional HTML pages, you might find that your existing
Actions don't provide you with what you need.  In this case, you can simply
create new Actions which would generate the needed data, and then forward to
the JSP which formats the data in XML.  As in the above example, you would
add additional entries into struts-config.xml for the new request.
</p>
<p>
You will likely find that a combination of the two above approaches will
suit your needs the best.
</p>
<p>
IBM has an article detailing a Web Services architecture with Struts at:
</p>
<p>
<a href="http://www-106.ibm.com/developerworks/webservices/library/ws-arcstruts/">Struts</a> 
</p>
<p>
 How do I integrate my existing infrastructure that generates HTML web pages with LPS?
Laszlo applications receive data by retrieving XML over HTTP using GET or POST methods. The easiest path to integrate a Laszlo application into existing HTML-web- application infrastructure is to simply modify existing server side code that generates HTML so that it generates XML instead.
</p>
<p>
How does LPS integrate with a struts application?
Struts is well suited to support both HTML-based applications and Laszlo-based applications at the same time.  There are many approaches you can take. One approach would be to write new JSPs that simply generate XML instead of HTML. You would then need to create new action mappings in struts-config.xml, which would forward to the XML generating JSP. This is a great approach to get started quickly as you can reuse your existing Actions you already wrote to generate html, but you will only have access to the data already generated by those actions.
</p>
<p>
Because Laszlo applications are really good at showing a lot more data in a useful manner than traditional HTML pages, you might find that your existing Actions don't provide you with what you need.  In this case, you can simply create new Actions which would generate the needed data, and then forward to the JSP which formats the data in XML.  As in the above example, you would add additional entries into struts-config.xml for the new request.
</p>
<p>
You will likely find that a combination of the two above approaches will suit your needs the best.
</p>
<p>
IBM has an article detailing a Web Services architecture with Struts at:
</p>
<p>
http://www-106.ibm.com/developerworks/webservices/library/ws-arcstruts/
</p>
<p>

How does LPS integrate with a Vignette?
Vignette supports both ASP and JSP environments that can accept and deploy XML content suitable for consumption by Laszlo applications.  Vignette offers an FAQ on their XML support at:  
http://www.vignette.com/Downloads/FAQ_XML.pdf
</p>
<p>
Are any customers using Vignette 7.1 today and how are they integrating with Laszlo?
None today, however, it would be a relatively straightforward exercise to integrate LPS with the existing Vignette XML support.
</p>
<p>

How do we integrate with the Java session id?
Since Laszlo applications rely on data consumption via XML, the best approach is to create an XML API to pull Java session data for consumption by the Laszlo application.  Looking ahead, Laszlo will most likely provide direct access to Java session data from inside the Laszlo environment.  
</p>
<p>
(Note: The Laszlo app proxies any session related cookies to/from the back-end as required; it can handle query-string url-rewriting as well).
</p>
<p>

How do we work with personalization or a personalization system?
Most portal servers, content management systems and personalization software have XML APIs today.  Since Laszlo apps use XML over http, there should not be any integration difficulties at all. Furthermore, if any of these systems use XML RPC, Java or SOAP, we can make it work.
</p>
<p>

What is our security model for passing data back and forthHow do we protect the integrity of the data?  
https is the solution since a single Laszlo application can make both http and https requests.  (The Laszlo app itself can also be served over either http or https, although we recommend serving the app over http and reserving https for secure transmissions only.)
</p>
<p>

Do we support sending cookies through the server to backends? 
Yes, each request made from the application to the LPS sends all cookies from the browser.  LPS then proxies cookies, and other required headers, from LPS to the backend server and back to the application. As long as the backend server is in the same domain as the LPS, the backend server will receive the browser's cookie.
</p>
<p>
(Details: The LPS proxies HTTP Set-Cookie response headers from the back-end up to the client. And it proxies any HTTP Cookie request headers from the client to the back-end.)
</p>
<p>
(Note: it is possible to make this work when the back-end and LPS aren't in the same domain, but a solution here ultimately depends on specific applications requirements.)
</p>
 





<!-- See other chapters in the D3 guide and also the wiki for more informtion on formatting chapters --> 
<!-- Here is a list of some topics you may want to discuss in this chapter-->

</body>
</html>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2001-2004 Laszlo Systems, Inc.  All Rights Reserved.              *
* Use is subject to license terms.                                            *
* X_LZ_COPYRIGHT_END ****************************************************** -->
